#ifndef SM_CORE_H
#define SM_CORE_H

#include <stdint.h>

typedef enum {
    TASK_OK = 0,
    TASK_ERR_FULL = 1,
    TASK_ERR_INVALID = 2
} TASK_RESULT;

// 任务初始化函数类型定义
typedef void (*TaskEventInit)(uint8_t task_id);

extern TASK_RESULT TASK_SendData(uint8_t task_id, uint8_t *buf, uint8_t len);
extern uint8_t TASK_RecvData(uint8_t task_id, uint8_t *buf, uint8_t maxlen);
extern TASK_RESULT TASK_SendEvent(uint8_t task_id, uint16_t event);
extern uint16_t TASK_RecvEvent(uint8_t task_id);

extern void TASK_Tick(void);
extern uint8_t TASK_Register(TaskEventInit init, uint16_t (*TaskHook)(uint8_t, uint16_t), uint8_t task_id, uint16_t period);
extern void TASK_Run(void);

#endif
